package fragments;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;


import com.example.zyfyptlw618.R;
import com.example.zyfyptlw618.avtivivites.CollectListActivity;


;

public class Fragment5 extends BaseFragment{
    private TextView owners;
    Button collectbt,followbt;
    private SharedPreferences sp;
    public Fragment5() {
    }


    @Nullable
    @Override //生命周期方法，创建View
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        sp= context.getSharedPreferences("login",Context.MODE_PRIVATE);
        return  inflater.inflate(R.layout.fragments5,container,false);
    }


    @Override//生命周期方法，View创建完成
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
         collectbt=view.findViewById(R.id.button2);
         owners=view.findViewById(R.id.textviewowner);
         collectbt.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 Intent intent=new Intent(getActivity(), CollectListActivity.class);
                 startActivity(intent);


             }
         });
        String name=sp.getString("username","");
        owners.setText("欢迎"+name);


         followbt=view.findViewById(R.id.button3);


        System.out.println("--f5--"+getSessiconId());//getSessionId是父类的方法

    }

}





